/*
 * Copyright 2011 Joe Choi. All rights reserved.
 */

package tec.data.persistence.jdbc;

import java.math.BigDecimal;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Ref;
import java.sql.ResultSetMetaData;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Calendar;

/**
 * 
 */
public interface JDBCResultSet {

		void close();
 
 		boolean wasNull();

    //======================================================================
    // Methods for accessing results by column index
    //======================================================================
		String getString(int columnIndex);
 
 		boolean getBoolean(int columnIndex);

		byte getByte(int columnIndex);
 
 		short getShort(int columnIndex);

		int getInt(int columnIndex);
 
 		long getLong(int columnIndex);

		float getFloat(int columnIndex);
 
 		double getDouble(int columnIndex);

		BigDecimal getBigDecimal(int columnIndex, int scale);
 
 		byte[] getBytes(int columnIndex);

		java.sql.Date getDate(int columnIndex);
 
 		java.sql.Time getTime(int columnIndex);

		java.sql.Timestamp getTimestamp(int columnIndex);

    java.io.InputStream getAsciiStream(int columnIndex);

    java.io.InputStream getUnicodeStream(int columnIndex);

    java.io.InputStream getBinaryStream(int columnIndex);

    //======================================================================
    // Methods for accessing results by column name
    //======================================================================
    String getString(String columnName);
    
		boolean getBoolean(String columnName);

    byte getByte(String columnName);

    short getShort(String columnName);

    int getInt(String columnName);

    long getLong(String columnName);

    float getFloat(String columnName);

    double getDouble(String columnName);

    BigDecimal getBigDecimal(String columnName, int scale);

    byte[] getBytes(String columnName);

    java.sql.Date getDate(String columnName);

    java.sql.Time getTime(String columnName);

    java.sql.Timestamp getTimestamp(String columnName);

    java.io.InputStream getAsciiStream(String columnName);

    java.io.InputStream getUnicodeStream(String columnName);

    java.io.InputStream getBinaryStream(String columnName);

    //=====================================================================
    // Advanced features:
    //=====================================================================
    SQLWarning getWarnings();

    void clearWarnings();

    String getCursorName();

    ResultSetMetaData getMetaData();

    Object getObject(int columnIndex);

    Object getObject(String columnName);

    int findColumn(String columnName);

    //--------------------------JDBC 2.0-----------------------------------

    java.io.Reader getCharacterStream(int columnIndex);

    java.io.Reader getCharacterStream(String columnName);

    BigDecimal getBigDecimal(int columnIndex);

    BigDecimal getBigDecimal(String columnName);

    //---------------------------------------------------------------------
    // Traversal/Positioning
    //---------------------------------------------------------------------
    boolean isAfterLast();
 
    boolean isFirst();
 
    boolean isLast();

    void beforeFirst();

    void afterLast();

    boolean first();

    boolean last();

    boolean next();
    
		int getRow();

    boolean absolute( int row );

    boolean relative( int rows );

    boolean previous();

    void setFetchDirection(int direction);

    int getFetchDirection();

    void setFetchSize(int rows);

    int getFetchSize();

    int getType();

    int getConcurrency();

    //---------------------------------------------------------------------
    // Updates
    //---------------------------------------------------------------------
    boolean rowUpdated();

    boolean rowInserted();
   
    boolean rowDeleted();

    void updateNull(int columnIndex);  

    void updateBoolean(int columnIndex, boolean x);

    void updateByte(int columnIndex, byte x);

    void updateShort(int columnIndex, short x);

    void updateInt(int columnIndex, int x);
    
		void updateLong(int columnIndex, long x);

    void updateFloat(int columnIndex, float x);

    void updateDouble(int columnIndex, double x);

    void updateBigDecimal(int columnIndex, BigDecimal x);

    void updateString(int columnIndex, String x);

    void updateBytes(int columnIndex, byte x[]);

    void updateDate(int columnIndex, java.sql.Date x);

    void updateTime(int columnIndex, java.sql.Time x);

    void updateTimestamp(int columnIndex, java.sql.Timestamp x);

    void updateAsciiStream(int columnIndex, java.io.InputStream x, int length);

    void updateBinaryStream(int columnIndex, java.io.InputStream x, int length);

    void updateCharacterStream(int columnIndex, java.io.Reader x, int length);

    void updateObject(int columnIndex, Object x, int scale);

    void updateObject(int columnIndex, Object x);

    void updateNull(String columnName);  

    void updateBoolean(String columnName, boolean x);

    void updateByte(String columnName, byte x);

    void updateShort(String columnName, short x);

    void updateInt(String columnName, int x);

    void updateLong(String columnName, long x);

    void updateFloat(String columnName, float x);

    void updateDouble(String columnName, double x);

    void updateBigDecimal(String columnName, BigDecimal x);

    void updateString(String columnName, String x);

    void updateBytes(String columnName, byte x[]);

    void updateDate(String columnName, java.sql.Date x);

    void updateTime(String columnName, java.sql.Time x);

    void updateTimestamp(String columnName, java.sql.Timestamp x);

    void updateAsciiStream(String columnName, java.io.InputStream x, int length);

    void updateBinaryStream(String columnName, java.io.InputStream x, int length);

    void updateCharacterStream(String columnName, java.io.Reader reader, int length);

    void updateObject(String columnName, Object x, int scale);
    
		void updateObject(String columnName, Object x);

    void insertRow();

    void updateRow();

    void deleteRow();

    void refreshRow();

    void cancelRowUpdates();

    void moveToInsertRow();

    void moveToCurrentRow();

    Statement getStatement();

    Object getObject(int i, java.util.Map<String,Class<?>> map);

    Ref getRef(int i);

    Blob getBlob(int i);

    Clob getClob(int i);

    Array getArray(int i);

    Object getObject(String colName, java.util.Map<String,Class<?>> map);

    Ref getRef(String colName);

    Blob getBlob(String colName);

    Clob getClob(String colName);

    Array getArray(String colName);

    java.sql.Date getDate(int columnIndex, Calendar cal);

    java.sql.Date getDate(String columnName, Calendar cal);

    java.sql.Time getTime(int columnIndex, Calendar cal);

    java.sql.Time getTime(String columnName, Calendar cal);

    java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal);

    java.sql.Timestamp getTimestamp(String columnName, Calendar cal);

    //-------------------------- JDBC 3.0 ----------------------------------------

    java.net.URL getURL(int columnIndex);

    java.net.URL getURL(String columnName);

    void updateRef(int columnIndex, java.sql.Ref x);
    
    void updateBlob(int columnIndex, java.sql.Blob x);

    void updateBlob(String columnName, java.sql.Blob x);

    void updateClob(int columnIndex, java.sql.Clob x);

    void updateClob(String columnName, java.sql.Clob x);

    void updateArray(int columnIndex, java.sql.Array x);

    void updateArray(String columnName, java.sql.Array x);
}
